package com.qf.thread;

public class EndlessLoopThread {
	
	
	public static void main(String[] args) {
		Thread t1 = new MyThread1();
		//long begin =System.currentTimeMillis();
		//优先级最高，概率问题，抢夺时间片的概率
		t1.setPriority(10);
		t1.start();
		
		//long end = System.currentTimeMillis();
		//System.out.println(end - begin);
		
		//cpu随机抢断
		//多线程执行顺序默认下完全不可控
		Thread t2 = new MyThread2();
		t2.setPriority(1);
		t2.start();

		//先打印main方法中数据
		System.out.println("程序执行完毕！");
		
	}

	
}
class MyThread1 extends Thread{
	@Override
	public void run() {
		// TODO Auto-generated method stub
		int i=1;
		while(i<100) {
			System.out.println("你好，你好!");
			i++;
			
		}
		super.run();
	}
		

	
	
}
class MyThread2 extends Thread{
	@Override
	public void run() {
		// TODO Auto-generated method stub
		int i=1;
		while(i<100) {
			System.out.println("我非常不好！");
			i++;
			
		}
		super.run();
	}
	

}